package org.ftc.util;
 
public class ListCalculator {
	
	protected int pageNo = 1;
	protected int recordsPerPage = 10;
	protected int totalPages = 0;
	protected int totalRecords = 0;
	
	public int firstResult(int pageNo){
		int offset = (recordsPerPage * (pageNo - 1) );
		return (offset < 0  ?  0 : offset );
	}

	public void setRecordsPerPage(int recordsPerPage) {
	    this.recordsPerPage = recordsPerPage;
	}

	//蝮賡���
	public int totalPages(int trec) {
	    return ((trec % this.recordsPerPage == 0) ? (trec / this.recordsPerPage) : (trec / this.recordsPerPage + 1));
	}
}
